﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        xfTasker.Tasker t = null;
        public Form1()
        {
            InitializeComponent();

            t =  xfTasker.Tasker.Instance();
            t.Interval = 3*1000;//1秒
            t.DoTask += new xfTasker.Tasker.DoTaskHandler(dosome);
        }

        private void button1_Click(object sender, EventArgs e)
        {
            t.Start();
        }

        private void dosome(object sender)
        {
            MessageBox.Show(DateTime.Now.ToShortDateString());
        }

        private void button2_Click(object sender, EventArgs e)
        {
            t = new xfTasker.Tasker();
            t.Stop();
        }
    }
}
